package com.wangyadong.hobby.front.model.event;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;

public class MyFirstEventService implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher applicationEventPublisher;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    public void sendEmail() {
        this.applicationEventPublisher.publishEvent(new MyFirstEvent(this));
    }

    public void sendEmail(MyFirstEvent myFirstEvent) {
        this.applicationEventPublisher.publishEvent(myFirstEvent);
    }
}
